<?php
//including header.php 
include '../../include/header.php';
//including page.php (It is a class which contain functions)
include '../../libraries/page.php';
//created object for page.hp
$page = new page();
//checking the session
session_start();
$adminid = $_SESSION['adminid'];

//To get current date and time
//date_default_timezone_set('Asia/Calcutta');
//$date1 = date("d-m-Y H:i:s");

//$user = $_SESSION['username'];
if (!$_SESSION['admin_username']) {
    header("location:login");
}
if ($_GET['q'] == 'logout') {
    $page->admin_logout();
    header("location:login");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $result = $page->mysql_insert_array("users", $_POST, "submit");
    if ($result) {
        $msg = $message[1];
    } else {
        $msg = $message[0];
    }
}
?>

<!--------------------------------------------------content----------------------------------->

<!-------------------------------------Navbar---------------------------------->
<div class="navbar">
    <div class="navbar-inner">
        <ul class="nav">
               <li><a href="index"><b style="font-size: 18px;margin-left: 30px">Admin</b></a></li>
   <!----         <li><a href="../groups/groups">Groups</a></li>
            <li class="active"><a href="products">Products</a></li>
            <li><a href="../suppliers/suppliers">Suppliers</a></li>---->
        </ul>
        <a class="brand" href="../index"  id="right_title"><b style="color:#333;">Inventory</b></a>
        <i class="icon-home" id ="right"></i>
    </div>
</div>
<div style="float:right; margin-right:30px"> <a href="?q=logout">Log out</a></div>

<!----------------------------------Display the result message of Addition--------------------->
<div  align="center"><? echo $msg; ?></div>

<!----------------------------------------------div for placing form here------------------------->
<div class="span4" style="height:300px; min-width: 230px; margin:0; margin-left: 40%; margin-top: 50px;">
    <h3 style="color:#777;margin-left: 25%;"> Add User</h3>
    <br />

    <!---------------------------------form------------------------------------------------>
    <form method="POST"  action="">


        <label>Username</label>
        <input class="input-xlarge" id="focusedInput" type="text" name="username" placeholder="Enter Name..."  required>
        <label>Password</label>
         <input class="input-xlarge" id="focusedInput" type="text" name="password" placeholder="Enter Password..."  required>
        <label>Email</label>
        <input class="input-xlarge" id="focusedInput" type="text" name="email" placeholder="Enter Email..."  >
        <input class="input-xlarge" id="focusedInput" type="hidden" name="randomcode" value="Admin created"  >
        <label>Active</label>
        <select name="active" > 
            <option>true</option>
            <option>false</option>
        </select><br>
        <button class="btn btn-inverse" type="submit" name="submit" style="float:right; margin-right: 15px; margin-top: 20px;">Add</button>

    </form>
</div>

<?php
//including footer.php
include '../../include/footer.php';
?>
